package expriment4_T9;

public class Test {
    public static void main(String[] args) {
                Market market = new Market();
                market.setName("大张超市");

                Goods goods1 = new Goods();
                goods1.setName("冰淇淋");
                Goods goods2 = new Goods();
                goods2.setName("薯片");
                Goods[] goodsArray = {goods1, goods2};
                market.setGoodsList(goodsArray);

                Person person = new Person();
                person.setName("王一博");

                Goods boughtGoods = person.shopping(market, "冰淇淋");
                if (boughtGoods != null) {
                    System.out.println(person.getName() + "在" + market.getName() + "买到了" + boughtGoods.getName());
                } else {
                    System.out.println(person.getName() + "在" + market.getName() + "没有买到所需商品");
                }

    }
}
